Qualify enum member names when referencing in value position#62034
Closed
RyanCavanaugh wants to merge 2 commits intomicrosoft:mainfrom
Closed
Qualify enum member names when referencing in value position#62034RyanCavanaugh wants to merge 2 commits intomicrosoft:mainfrom
RyanCavanaugh wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #61944 by ensuring that enum member names are qualified when referenced in value positions during declaration emission. The change prevents TypeScript from emitting invalid unqualified enum member references in declaration files.
Key changes:
- Modified the symbol qualification logic in the type checker to force qualification for enum members in value contexts
- Added a test case to verify the fix works correctly for enum members referenced within namespaces
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/compiler/checker.ts |
Updated symbol qualification logic to force qualification for enum members in value contexts |
tests/cases/compiler/invalidUnqualifiedEnum.ts |
Added test case with enum and namespace scenario that would previously emit invalid code |
tests/baselines/reference/invalidUnqualifiedEnum.types |
Test baseline for type information output |
tests/baselines/reference/invalidUnqualifiedEnum.symbols |
Test baseline for symbol resolution output |
tests/baselines/reference/invalidUnqualifiedEnum.js |
Test baseline for compiled JavaScript and declaration file output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #61944
This doesn't have any observable effects (AFAICT) on the forms like
because we never try to declaration emit those in symbolic form - for a literal value of
bar, they're both= 0; for a computed value, you don't see the initializer onbazat all